﻿#include "animationManager_Shifting.h"


AnimationManager_Shifting& AnimationManager_Shifting::I(){

    static AnimationManager_Shifting instance;

    return instance;
}

AnimationManager_Shifting::AnimationManager_Shifting()
{
    _state = new AnimationState_Shifting();
    _controller = new AnimationController_Shifting(_state);

}

AnimationManager_Shifting::~AnimationManager_Shifting()
{
}

QVariantMap AnimationManager_Shifting::requestInfo(){
    return _controller->requestInfo();
}


/** @brief 打开夹爪 */
void AnimationManager_Shifting::openClamp(){
    _state->setClampState(0);
}
/** @brief 关闭夹爪 */
void AnimationManager_Shifting::closeClamp(){
    _state->setClampState(1);
}
/** @brief 挡板推进去 */
void AnimationManager_Shifting::pushBaffle(){
    _state->setBaffleState(0);
}
/** @brief 挡板拉出来 */
void AnimationManager_Shifting::pullBaffle(){
    _state->setBaffleState(1);
}
/** @brief 开盖 */
void AnimationManager_Shifting::openCap(){
    _state->openCap();
}
/** @brief 关盖 */
void AnimationManager_Shifting::closeCap(){
    _state->closeCap();
}
/** @brief 取靶 */
void AnimationManager_Shifting::takeTarget(){
    _state->takeTarget();
}
/** @brief 放靶 */
void AnimationManager_Shifting::placeTarget(){
    _state->placeTarget();
}
/** @brief 中间的杆回到原点位置 */
void AnimationManager_Shifting::resetBar(){
    _state->resetBar();
}
/** @brief 设置蠕动泵 */
void AnimationManager_Shifting::setPPumpState(int state){
    _state->setPPumpState(state);
}
/** @brief 运动到活检 */
void AnimationManager_Shifting::moveToRadio(){
    _state->moveToRadio();
}

/** @brief 活检上移和下移 */
void AnimationManager_Shifting::upRadioBar(){
    _state->setRadioBarState(0);
}
void AnimationManager_Shifting::downRadioBar(){
    _state->setRadioBarState(1);
}

/** @brief 开始吹靶材 */
void AnimationManager_Shifting::openBlowTarget(){
    _state->setBlowTargetState(1);
}
/** @brief 停止吹靶材 */
void AnimationManager_Shifting::closeBlowTarget(){
    _state->setBlowTargetState(0);
}

/** @brief 开盖新加的不知道到底是啥玩意的动作 */
void AnimationManager_Shifting::baCaiGuaiJiaJin(){
    _state->step_move2cap();
    _state->step_capDown();
    _state->step_closeCapClamp();
}
void AnimationManager_Shifting::baCaiGuaiSongKai(){
    _state->step_move2cap();
    _state->step_capDown();
    _state->step_openCapClamp();
}
void AnimationManager_Shifting::yuanDianJiaJin(){
    _state->step_move2origin();
    _state->step_closeCapClamp();
}
void AnimationManager_Shifting::yuanDianSongKai(){
    _state->step_move2origin();
    _state->step_openCapClamp();
}
void AnimationManager_Shifting::kaiGai(){
    _state->openCap();
}
void AnimationManager_Shifting::guanGai(){
    _state->closeCap();
}
void AnimationManager_Shifting::baCaiGuanWeiZhi(){
    _state->step_move2cap();
}
void AnimationManager_Shifting::chuShiWeiZhi(){
    _state->step_move2origin();
}
/** @brief Z轴气缸（我取不出来名字了） */
void AnimationManager_Shifting::zQiGangUp(){
    _state->step_upTarget();
}
void AnimationManager_Shifting::zQiGangDown(){
    _state->step_downTarget();
}

/** @brief 下位机发位置后瞬移过去 */
void AnimationManager_Shifting::teleportX(int idx){
    _controller->teleportX(idx);
}

void AnimationManager_Shifting::teleportZ(int idx){
    _controller->teleportZ(idx);
}

/** @brief 设置机型 1带溶靶瓶和蠕动泵 2不带 */
void AnimationManager_Shifting::setMachineType(int type){
    _state->_machineType = type;
    _controller->refreshBarPosiByMachineType(type);
    _state->reset();
    _controller->reset();
}



void AnimationManager_Shifting::reset(){
    _state->reset();
}
